package job.qi.dftf;

import java.io.IOException;

import job.qi.dftf.Qi_DFTF_Record.FieldCounter;
import mapred.base.TextMapper;

import org.apache.hadoop.io.Text;

public class Qi_DFTF_Filter_Mapper extends TextMapper {

    private static FieldCounter fc;

    private static long more;

    @Override
    public void map(Text key, Text value) throws IOException {
        Qi_DFTF_Record rec = new Qi_DFTF_Record(value.toString());
        if (rec.get(fc) >= more) {
            this.output(key, value);
        }
    }

    @Override
    public void setUp() {
        fc = FieldCounter.valueOf(this.getConfig("field").toLowerCase());
        more = Long.parseLong(this.getConfig("more"));
    }

    @Override
    public void tearDown() throws IOException {
    }

}
